/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved.
 * Description: local rdma rma buffer interface
 */

#ifndef LOCAL_RDMA_RMA_BUFFER_H
#define LOCAL_RDMA_RMA_BUFFER_H

#include <memory>
#include <string>
#include "hccl_common.h"
#include "hccl_network_pub.h"
#include "rma_buffer.h"

namespace hccl {
class LocalRdmaRmaBufferImpl;

class LocalRdmaRmaBuffer : public RmaBuffer {
public:
    LocalRdmaRmaBuffer(const HcclNetDevCtx netDevCtx, void* addr, u64 size,
        const HcclMemType memType = HcclMemType::HCCL_MEM_TYPE_DEVICE);

    HcclResult Init();
    HcclResult Destroy();
    ~LocalRdmaRmaBuffer() override;

    LocalRdmaRmaBuffer(const LocalRdmaRmaBuffer &that) = delete;
    LocalRdmaRmaBuffer &operator=(const LocalRdmaRmaBuffer &that) = delete;

    // Init成功后调用Serialize和获取属性接口
    std::string Serialize();

    u32 GetKey() const;

private:
    std::unique_ptr<LocalRdmaRmaBufferImpl> pimpl_;
};
}
#endif //  LOCAL_RDMA_RMA_BUFFER_H